from flask import Flask
from flask_migrate import Migrate, MigrateCommand
from flask_script import Manager

from models import db
from views import registered_blue, home_blue, user_blue,shop_blue

# 创建flask对象
app = Flask(__name__)

# 加载数据库配置文件
app.config.from_pyfile('config.ini')

# 注册蓝图
app.register_blueprint(registered_blue)
app.register_blueprint(home_blue)
app.register_blueprint(user_blue)
app.register_blueprint(shop_blue)

# 添加过滤器


db.init_app(app)

# 添加数据库迁移工具
manager = Manager(app)
# 生成migrate对象 用来数据库迁移
migrate = Migrate(app, db)
# 添加db命令
manager.add_command('db', MigrateCommand)

if __name__ == '__main__':
    manager.run()




